package com.esint.validation.entity.ajax;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @description: http访问相应类
 * @author: 谷明
 * @createDate: 2021/8/12 21:30
 */
@Data
@Accessors(chain = true)
public class AjaxResult {
    private Integer code;
    private String msg;
    private Object data;

    public static AjaxResult GetOperSuccessObj(){
        AjaxResult res = new AjaxResult();
        res.code = ServerMessage.RequestSuccessCode;
        res.msg = ServerMessage.RequestSuccess;
        return res;
    }

    public static AjaxResult GetValidFailedObj(){
        AjaxResult res = new AjaxResult();
        res.code = ServerMessage.RequestParamErrorCode;
        res.msg = ServerMessage.RequestParamError;
        return res;
    }

    public static AjaxResult GetUnknowErrorObj(){
        AjaxResult res = new AjaxResult();
        res.code = ServerMessage.unKnowErrorCode;
        res.msg = ServerMessage.unKnowError;
        return res;
    }
}
